﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 函数重载
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(SayHello());
            Console.WriteLine(SayHello("linda"));
            Console.WriteLine(SayHello("tom", "linda"));
            Console.WriteLine(SayHello(3));

            Console.ReadKey();
        }
        //构成函数重载的条件：函数参数类型不同或者函数参数个数不一样，与函数返回类型无关
        static string SayHello()
        {
            return "你好！";
        }

        static string SayHello(string name)
        {
            return name + "你好！";
        }

        static string SayHello(string name1, string name2)
        {
            return name1 + name2 + "你们好！";
        }

        static string SayHello(int i)
        {
            return "数字" + i + "你好！";
        }
    }
}
